package com.falm.cli.command;

import cn.hutool.core.io.FileUtil;
import picocli.CommandLine;

import java.io.File;
import java.util.List;
import java.util.concurrent.Callable;

/**
 * @author Administrator
 */
@CommandLine.Command(name = "list", version = "list 1.0", mixinStandardHelpOptions = true)
public class ListCommand implements Callable<Integer> {

    public static final String PROPERTY = System.getProperty("user.dir") + File.separator + "example" + File.separator + "acm-template";

    @CommandLine.Option(names = {"-o", "--output"}, description = "输出文件路径", interactive = true, arity = "0..1", echo = true)
    private String outputPath = PROPERTY;

    @Override
    public Integer call() throws Exception {
        List<File> fileList = FileUtil.loopFiles(new File(outputPath));
        fileList.forEach(System.out::println);
        System.out.println();
        return 0;
    }
}
